<template>

    <el-table :data="selectQuestionList" style="width: 100%"  class='tables'>
      <el-table-column label="题库名称" align="center" prop="bankName">
        <template #default="scope">
          <el-tag v-if="scope.row.bankName!=null&&scope.row.bankName!=''">
            {{scope.row.bankName}}
          </el-tag>
          <el-tag v-else>
            ----
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="题目文本" align="center" prop="questionText" />
      <el-table-column label="题目类型" align="center" prop="questionType" >
        <template #default="scope">
          <el-tag v-if="scope.row.questionType===1">
            单选
          </el-tag>
          <el-tag v-if="scope.row.questionType===2">
            多选
          </el-tag>
          <el-tag v-if="scope.row.questionType===3">
            判断
          </el-tag>
          <el-tag v-if="scope.row.questionType===4">
            填空
          </el-tag>
          <el-tag v-if="scope.row.questionType===5">
            简答
          </el-tag>
          <el-tag v-if="scope.row.questionType===6">
            问答
          </el-tag>
          <el-tag v-if="scope.row.questionType===7">
            计算
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="难度" align="center" prop="difficultyLevel" >
        <template #default="scope">
          <el-tag v-if="scope.row.difficultyLevel===1">
            简单
          </el-tag>
          <el-tag v-if="scope.row.difficultyLevel===2">
            一般
          </el-tag>
          <el-tag v-if="scope.row.difficultyLevel===3">
            中等
          </el-tag>
          <el-tag v-if="scope.row.difficultyLevel===4">
            困难
          </el-tag>
          <el-tag v-if="scope.row.difficultyLevel===5">
            极难
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
      <el-table-column label="Operations">
        <template #default="scope">

          <el-button
            size="small"
            type="danger"
            @click="handleDeleteSelect(scope.$index, scope.row)"
          >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

</template>
<script setup>
import {dateFormatter} from "@/utils/formatTime";
import {defineProps, reactive} from 'vue';
const props = defineProps({
  tabaleList:Array // 子组件接收父组件传递的用户ID参数
});
function handleDeleteSelect(index, row){
  console.log(index)
  selectQuestionList.splice(index, 1);
}
const selectQuestionList = reactive(props.tabaleList);

</script>